package com.lkk.cg.util;

/**
 * Created by lkk on 2014/12/17.
 */
public class NumberUtils {

    /**
     * 将一个对象转换成Long型的整数，如果转换失败，就返回0L，而不是null
     *
     * @param object 待转换的数
     * @return
     */
    public static Long convertToLong(Object object) {
        if (object == null)
            return 0L;

        Long result = null;
        try {
            result = (Long) object;
        } catch (ClassCastException e) {
            return 0L;
        }
        return result;
    }
}
